tests: don't create a syslinux stub unconditionally in libtest
authorJavier Martinez Canillas <javier.martinez@collabora.co.uk>
Sat, 31 Aug 2013 21:04:48 +0000 (23:04 +0200)
committerColin Walters <walters@verbum.org>
Sun, 15 Sep 2013 16:46:39 +0000 (12:46 -0400)
libtest.sh has an setup_os_repository() helper function tha is
used by many tests to setup an OSTree initial repository.

This function creates an syslinux configuration unconditionally
but OSTree supports other bootloader backends besides syslinux.

So, is better to conditionally create a syslinux configuration
only when it is needed.

https://bugzilla.gnome.org/show_bug.cgi?id=708069

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
tests/libtest.sh
tests/test-admin-deploy-1.sh
tests/test-admin-deploy-2.sh

index eeedf9150a549824774b918be8f66ccd4ccf11ce..b05e72bcdbbaf35acd9dffd3ca42113dd9042f24 100644 (file)
@@ -155,8 +155,19 @@ setup_fake_remote_repo1() {
     export OSTREE="ostree --repo=repo"
 }
 
+setup_os_boot_syslinux() {
+    # Stub syslinux configuration
+    mkdir -p sysroot/boot/loader.0
+    ln -s loader.0 sysroot/boot/loader
+    touch sysroot/boot/loader/syslinux.cfg
+    # And a compatibility symlink
+    mkdir -p sysroot/boot/syslinux
+    ln -s ../loader/syslinux.cfg sysroot/boot/syslinux/syslinux.cfg
+}
+
 setup_os_repository () {
     mode=$1
+    bootmode=$2
     shift
 
     oldpwd=`pwd`
@@ -207,13 +218,9 @@ EOF
     ostree admin --sysroot=sysroot init-fs sysroot
     ostree admin --sysroot=sysroot os-init testos
 
-    # Stub syslinux configuration
-    mkdir -p sysroot/boot/loader.0
-    ln -s loader.0 sysroot/boot/loader
-    touch sysroot/boot/loader/syslinux.cfg
-    # And a compatibility symlink
-    mkdir -p sysroot/boot/syslinux
-    ln -s ../loader/syslinux.cfg sysroot/boot/syslinux/syslinux.cfg
+    if [ $bootmode = "syslinux" ]; then
+        setup_os_boot_syslinux
+    fi
 }
 
 os_repository_new_commit ()
index fbf9fc27bafb302da6f8b41094b01c3dc6980811..62580a4ca6814781ed2cfd1c45b9400d2d3e33b8 100755 (executable)
@@ -23,7 +23,7 @@ set -e
 
 echo "1..1"
 
-setup_os_repository "archive-z2"
+setup_os_repository "archive-z2" "syslinux"
 
 echo "ok setup"
 
index d7ddf5f5904cd018dc6717c72d7a4c7b9b8b1403..a133e701ec49c5dc724b73019c3427fdd76196da 100755 (executable)
@@ -23,7 +23,7 @@ set -e
 
 echo "1..1"
 
-setup_os_repository "archive-z2"
+setup_os_repository "archive-z2" "syslinux"
 
 echo "ok setup"